TC循环题目``帮帮手

来源:百度知道 编辑:UC知道 时间:2024/05/10 10:40:11
就是好象QQ输入密码帐号那样,用if,else语句,和do while.输入错误3次就没有机会了.``设帐号:123,密码:456

#include 'stdio.h'

main(){

int username=0,password=0;
int n=0;/* 记录错误次数 */
scanf("%d",&username);
scanf("%d",&password);
while(n>3){
if((123!=username)&&(456!=password)){
n++;
printf("error %d",n);
scanf("%d",&username);
scanf("%d",&password);}
else
printf("sucess!");
n=0;
}
printf("you are limited by system");
}

自己手写的没环境调试,我检查了一下应该没错误。